
#include <cxxomfort/base.hpp>
#include <cxxomfort/cstdio.hpp>
#include <cxxomfort/string_view.hpp>
#include <cxxomfort/ostream.hpp>
#include <cxxomfort/library/type_name.hpp>
#include <cstdio>
#include <iostream>

int main () {
	using namespace std;
	cxxomfort::output_info();
	cout<< endl;
	
	string_view fi = __DATE__;

	cout<< "std: User-defined literals:\n";
	#if (defined(__cpp_user_defined_literals) && defined(__cpp_lib_string_udls))
	using namespace std::literals::string_literals;
	cout<< "string"s << "\n";
	cout<< "string_view"sv << "\n";
	#else
	cout<< "N/A \n";
	#endif

	cout<< "\n";
	cout<< "cxxo: String helpers:\n";
	using namespace cxxomfort::fix::string_helpers;
	//cout<< s("string")<< "\n";
	cout<< sv("string_view")<< "\n";
	
	cout<< "\n";
	cout<< "cxxo_ _sv string literal:\n";
	#if defined(__cpp_user_defined_literals)
	using namespace cxxomfort::fix::string_literals;
	cout<< cxxomfort::typeid_demangle(typeid("string_view"_sv))<< endl;
	#else
	cout<< "N/A \n";
	#endif

	cout<< "\n";
	cout<< "string_view from a macro: ";
	cout<< "["<< fi<< "]"<< endl;
	
	string_view msg1 = "wololoooooo";
    string_view::iterator it1 = begin(msg1);
    (void)it1;
    string_view::const_iterator it2 = end(msg1);
    (void)it2;
	cout<< msg1<< endl;
#if 0
    // this should fail:
    //msg1[1]= 'a';
#endif

}
